function showList() {
	var f=document.contentForm;
	document.location.href="/wetogether/board.do?mode=getContentList&boardId="
		+f.boardId.value+"&locationId="+f.locationId.value+"&page="+f.getPage.value;
}
function onModify() {
	var f=document.contentForm;
	f.method="post";
	document.location.href="board.do?flag=modify&mode=tilesSetting&contentId="+f.contentId.value+"&title="+f.title.value
	+"&groupId="+f.groupId.value+"&groupPosition="+f.groupPosition.value+"&groupDepth="+f.groupDepth.value
	+"&memberId="+f.memberId.value+"&getPage="+f.getPage.value+"&boardId="+f.boardId.value+"&locationId="
	+f.locationId.value+"&content="+f.content.value;
}
function onDelete() {
	var f=document.contentForm;
	var flag=confirm("삭제하시겠습니까?");
	if(flag) { 			
		document.location.href="/wetogether/board.do?mode=deleteContent&contentId="+f.contentId.value
		+"&boardId="+f.boardId.value+"&locationId="+f.locationId.value+"&getPage="+f.getPage.value;		
	} else {
		history.go(-1);	
		return false;
	}
	return false;
	
}
function onReply() {
	var f=document.contentForm;
	document.location.href="board.do?flag=reply&mode=tilesSetting&title="+f.title.value+"&groupId="+f.groupId.value
	+"&groupPosition="+f.groupPosition.value+"&groupDepth="+f.groupDepth.value+"&memberId="+f.memberId.value
	+"&getPage="+f.getPage.value+"&boardId="+f.boardId.value+"&locationId="+f.locationId.value;
	
}

function saveReply() {
	var f=document.replyForm;	
	if(f.title.value=="") {
		alert("제목을 입력하세요");
		f.title.focus();
		return false;
	}else if(f.content.value=="") {
		alert("내용을 입력하세요");
		f.content.focus();
		return false;
	}
	return extCheck(f);
}

function saveWrite() {
	var f=document.writeForm;	
	if(f.title.value=="") {
		alert("제목을 입력하세요");
		f.title.focus();
		return false;
	}else if(f.content.value=="") {
		alert("내용을 입력하세요");
		f.content.focus();
		return false;
	}
	return extCheck(f);
}

function saveModify() {
	var f=document.modifyForm;	
	if(f.title.value=="") {
		alert("제목을 입력하세요");
		f.title.focus();
		return false;
	}else if(f.content.value=="") {
		alert("내용을 입력하세요");
		f.content.focus();
		return false;
	}
	return extCheck(f);
}



function extCheck(formName) {
	var upFileName=formName.uploadFile.value;
	if(upFileName!="") {
		upFileName=upFileName.toLowerCase();//소문자로 변경하여 비교
		var ext=upFileName.substring(upFileName.lastIndexOf(".")+1);
		switch(ext) {
		case "png": case "jpg": case "bmp": case "gif":
			return true;
			break;
		default:
			alert("그림파일만 업로드 가능!!");
			return false;	
		}
	}
	return true;
}
//파일 사이즈 계산
function calFileSize (oldSize) {
	if(oldSize < 1048576) {
		document.write(Math.round(oldSize/1024)+"KB");
	}else {
		document.write((oldSize/1048576).toFixed(2)+"MB");
	}
}

/*
 * list.jsp 에 있던 스크립드 옮겨왔습니다.	from 종선
 */
function search(boardId, locationId) {
	var findSetting = document.getElementById("findSetting").value;
	var findName = document.getElementById("findName").value;
	location.href = "/wetogether/board.do?mode=getContentList&boardId=" + boardId + "&locationId=" + locationId 
					+ "&findSetting=" + findSetting + "&findName=" + findName;
}
function allList(boardId, locationId) {
	location.href = "/wetogether/board.do?mode=getContentList&boardId=" + boardId + "&locationId=" + locationId;
}